package com.openlab.homeAdapter;

import java.util.ArrayList;
import java.util.Map;

import com.openlab.activity.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PostContentAdapter extends BaseAdapter{

		private Context context;
		private ArrayList<Map<String, Object>> list;
	
		public PostContentAdapter(Context context, ArrayList<Map<String, Object>> list){
			this.context = context;
			this.list = list;			

		}
		
		@Override
		public int getCount() {
			return list.size();
		}

		@Override
		public Object getItem(int position) {
			return list.get(position);
		}

		@Override
		public long getItemId(int position) {
			return position;
		}
		
		@Override
		public View getView(int position, View convertView, ViewGroup parent) {  
			if(convertView == null){
				convertView = LayoutInflater.from(context).inflate(R.layout.post_content_list, null);   
			}
			String str = list.get(position).get("name").toString();

			TextView postName = (TextView)convertView.findViewById(R.id.post_content_text);
			postName.setText(str);
			
			return convertView;
		}

	}
